package ex_8_StringAndSyn;


public class Service {
    public static void testMethod(String anyString){
        synchronized (anyString){
            try {
                System.out.println("testMethod getLock time=" + System.currentTimeMillis() + " run ThreadName =" +
                        Thread.currentThread().getName());
                Thread.sleep(2000);
                System.out.println("testMethod releaseLock time=" + System.currentTimeMillis() + " run ThreadName =" +
                        Thread.currentThread().getName());
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}
